package com.laf.service.impl;

import com.github.pagehelper.PageHelper;
import com.laf.mapper.UserMapper;
import com.laf.model.Userinfo;
import com.laf.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author: He Changjie  on  2018-09-28
 * @description:
 */
@Service("userService")
public class UserServiceImpl implements UserService {

    @Resource
    UserMapper mapper;

    @Override
    public Userinfo findByUserName(Userinfo userinfo) {
        return mapper.findByUserName(userinfo);
    }

    @Override
    public List<Userinfo> selectByPage(Userinfo userinfo, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Userinfo> list = mapper.selectByPage(userinfo, pageNum, pageSize);
        return list;
    }

    @Override
    public Userinfo login(Userinfo userinfo) {
        return mapper.login(userinfo);
    }

    @Override
    public int saveUser(Userinfo userinfo) {
        return mapper.saveUser(userinfo);
    }

    @Override
    public void updateLogTime(Userinfo userinfo) {
        mapper.updateLogTime(userinfo);
    }

    @Override
    public int updatePassword(Userinfo userinfo) {
        return mapper.updatePassword(userinfo);
    }
}
